﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace AsycServer
{
    public partial class AsyUdpServer
    {
        class MessageInfo
        {
            MessageBuffer message;
            IPEndPoint adress;
            AsyUdpServer server;

            public MessageBuffer Message
            {
                get { return message; }
                set { message = value; }
            }

            public IPEndPoint Adress
            {
                get { return adress; }
                set { adress = value; }
            }

            public MessageInfo(MessageBuffer message, IPEndPoint endPoint, AsyUdpServer s)
            {
                server = s;
                Message = message;
                Adress = endPoint;
            }

            public void Send()
            {
                server.udpSocket.Send(message.Array, message.Size, adress);
            }
        }
    }
}